lets_plot.bistro.im.image_matrix¶
-
lets_plot.bistro.im.image_matrix(image_data_array, *, norm: Optional[bool] = None, scale=1) → lets_plot.plot.plot.GGBunch¶ Display images in a grid. The grid dimensions are determined by shape of the input 2D ndarray.
Elements of the input 2D array are images specified by ndarrays with shape (n, m) or (n, m, 3) or (n, m, 4).
- Parameters
image_data_array (ndarray) – 2D numpy.ndarray containing images. Specifies dimensions of output grid.
norm (bool, default=True) – False value disables default scaling of a luminance (grayscale) images to the (0, 255) range.
scale (float, default=1.0) – Specifies magnification factor.
- Returns
Plot bunch object.
- Return type
GGBunch
Examples
1 2 3 4 5 6 7 8 9
import numpy as np from lets_plot import * from lets_plot.bistro.im import * LetsPlot.setup_html() np.random.seed(42) image = np.random.randint(256, size=(64, 64, 3)) matrix = np.empty((2, 3), dtype=object) matrix.fill(image) image_matrix(matrix)
1 2 3 4 5 6 7 8 9 10 11 12
import numpy as np from lets_plot import * from lets_plot.bistro.im import * LetsPlot.setup_html() rows, cols = 3, 3 matrix = np.empty((rows, cols), dtype=object) for r in range(rows): for c in range(cols): w, h = 32 + 16 * c, 32 + 16 * r matrix[r][c] = 256 * np.linspace(np.linspace(0, .5, w), \ np.linspace(.5, .5, w), h) image_matrix(matrix, norm=False, scale=1.5)